home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
unclcarl
/
gfahelp2
/
gfa_demo.gfa
(
.txt
)
< prev
next >
Wrap
GFA-BASIC Atari
|
1995-04-25
|
12KB
|
253 lines
REM The character ' is the same as REM
' See ?
REM @ is the same as GOSUB
REM Place the cursor on >PROCEDURE and hit the HELP key to open it
REM The character ! is the same as REM, when placed AFTER a command
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
'
' ----------------------------| CL ear S creen
CLS
' ----------------------------| Get screen resolution
rez%=XBIOS(4) ! rez%= 0=ST LOW, 1=ST MED, 2=ST HIGH
' 4=TT MED, 6=TT HIGH, 7=TT LOW
'
' ----------------------------| If rez%= ST LOW or TT LOW
IF rez%=0 OR rez%=7
ALERT 3,"|This demo only |works in ST/TT |MED & HIGH rez.",1," Ok ",a#
END
ENDIF
' ----------------------------| Determine current path
julie$=CHR$(GEMDOS(25)+65)+":"
' ----------------------------| GOSUB Save palette routine
@save_palette
' ----------------------------| GOSUB load_it routine
@load_it
' ----------------------------| GOSUB dimwit routine
@dimwit
' ----------------------------| GOSUB grace routine
@grace
' ----------------------------| SAVE/RESTORE screen colours
> PROCEDURE save_palette
' You don't really NEED to erase the palette buffer since you are only
' calling this routine once. It's there to remind you that you CANNOT
' DIMension an array twice.
ERASE palette#()
DIM palette#(15)
LOCAL i#
FOR ctr%=0 TO 15
palette#(ctr%)=XBIOS(7,W:ctr%,W:-1)
NEXT ctr%
RETURN
> PROCEDURE restore_palette
LOCAL ctr%
FOR ctr%=0 TO 15
SETCOLOR ctr%,palette#(ctr%)
NEXT ctr%
RETURN
' ----------------------------| RSC file addresses (from .LST file)
> PROCEDURE definitions
' These are the address numbers for the objects in the .RSC file
LET menutree&=0 !RSC_TREE
LET xyzzymen&=16 !Obj in #0
LET quitmenu&=18 !Obj in #0
LET panelone&=1 !RSC_TREE
LET radioa&=3 !Obj in #1
LET radiob&=4 !Obj in #1
LET radioc&=5 !Obj in #1
LET okaybutt&=11 !Obj in #1
LET canclbut&=12 !Obj in #1
LET edittext&=17 !Obj in #1
LET dialog01&=2 !RSC_TREE
LET about&=7 !Obj in #0
RETURN
' ----------------------------| Load RSC file
> PROCEDURE load_it
IF RSRC_LOAD(julie$+"rsc_demo.rsc") !Resource load
~RSRC_GADDR(0,0,menu_adr%) !Assign Variables to menu_adr%
' ^0 is the address for the menu-bar in PROCEDURE definitions
~MENU_BAR(menu_adr%,1) !Display menu-bar
ELSE
ALERT 3,"|Resource file |NOT found..! ",1," Bye ",a#
@restore_palette !Restore screen colours
CLS !Clear screen
END
ENDIF
RETURN
' ----------------------------| DIMension menu message buffer
> PROCEDURE dimwit
' You don't really NEED to erase the message buffer since you are only
' calling this routine once. It's there to remind you that you CANNOT
' DIMension an array twice.
ERASE message_buffer%()
DIM message_buffer%(3)
mes_adr%=V:message_buffer%(0)
ABSOLUTE mes_type&,mes_adr%
ABSOLUTE m_title&,mes_adr%+6
ABSOLUTE m_enter&,mes_adr%+8
RETURN
' ----------------------------| Clear screen below menu
> PROCEDURE fill_it
' 1280 by 1280 is the MAXIMUM screen width and height currently available
' for STs and TTs. This number allows this 1 call to work in ALL resolutions.
~FORM_DIAL(3,0,0,0,0,0,0,1280,1280)
RETURN
' ----------------------------| Disable ACCessories
> PROCEDURE disable_accs
' Most DAs don't clean up after themselves. You can either use this
' routine to disable them or open a window and use RC_INTERSECT to track
' them. THIS is the easy way.
FOR xtc#=9 TO 15
~MENU_IENABLE(menu_adr%,xtc#,1)
' ^ 0 disables them, 1 reenables them
NEXT xtc#
RETURN
' ----------------------------| MENU BAR
> PROCEDURE grace
@disable_accs ! Disable ACCS
@fill_it ! Clear screen below menu
' ---------------------|* MENU LOOP
REPEAT
ON ERROR GOSUB oops
hairy:
~EVNT_MULTI(&X110000,0,0,0,0,0,0,0,0,0,0,0,0,0,mes_adr%,500)
IF mes_type&=10 !If a menu entry is chosen
IF obj_nr%<>m_enter& !Object # <> menu entry
obj_nr%=m_enter& !Object # = menu entry
' ---------------------------------------------------------------------|
IF obj_nr%=7 !If the menu object is chosen
' !(the number corresponds to the number
' !in the DEFINITIONS)
@normal_it !Unselect menu bar choice
@about_foolish !About menu
mes_type&=0 !Erase choice from buffer
~RSRC_GADDR(0,0,menu_adr%) !Return menu bar
@fill_it !Clear screen below menu
@shrinkbox
ENDIF
' ---------------------------------------------------------------------|
IF obj_nr%=18 !Quit Menu
@normal_it
GOTO imdone
ENDIF
' ---------------------------------------------------------------------|
IF obj_nr%=16 !XYZZY
@normal_it
@growbox
@panel_uno
mes_type&=0
~RSRC_GADDR(0,0,menu_adr%)
@fill_it
@shrinkbox
ENDIF
' ---------------------------------------------------------------------|
ENDIF
ELSE
GOTO hairy
ENDIF
UNTIL MOUSEK=4 !No escape from THIS loop <grin>
imdone:
~MENU_BAR(menu_adr%,0)
~RSRC_FREE()
@restore_palette
CLS
@fill_it
END
RETURN
' ----------------------------| Return MENU to normal
> PROCEDURE normal_it
~MENU_TNORMAL(menu_adr%,m_title&,1) !Return menu to normal
obj_nr%=0 !no object selected for buffer
RETURN
' ----------------------------| XYZZY Panel
> PROCEDURE panel_uno
merrill:
@listing !Clear\ReDIMension radios
' ---------------------------------------------------------------------------
~RSRC_GADDR(0,1,panel%) !Return RSC address for panel
' ^ 1 is the address in DEFINITIONS for the panel
' ---------------------------------------------------------------------------
~FORM_CENTER(panel%,x%,y%,w%,h%) !Center it on screen
' ---------------------------------------------------------------------------
CHAR{{OB_SPEC(panel%,17)}}=" " !Clear EDIT line
' ^ 17 is the address of EDIT in DEFINTIONS
'
CHAR{{OB_SPEC(panel%,17)}}="" !Move cursor to left
' ---------------------------------------------------------------------------
~OBJC_DRAW(panel%,0,5,x%,y%,w%,h%) !Draw the panel
' ^ 5 means draw EVERYTHING in box, the lower the
' number, the less of the boxes contents appear
' on the screen
' ---------------------------------------------------------------------------
ex_obj%=FORM_DO(panel%,0) !Wait for exit object to be
' selected
' ---------------------------------------------------------------------------
~OBJC_CHANGE(panel%,12,0,x%,y%,w%,h%,0,1) !Reset Cancel Button
' ^Cancel Button
' ---------------------------------------------------------------------------
IF ex_obj%=12 !If the exit object is the CANCEL button
ALERT 1,"|You have selected |Cancel...",1," Boof! ",lk%
GOTO jerky_joel
ENDIF
' ---------------------------------------------------------------------------
edit$=CHAR{{OB_SPEC(panel%,17)}} !edit$=What you type in
' ^ TEXT you have typed in ^EDIT line
' ---------------------------------------------------------------------------
@check_radios !Check if RADIO BUTTON was selected
' ---------------------------------------------------------------------------
IF edit$>""
ALERT 1,"|You have entered |"+edit$+"|on the EDIT line. ",1," Ok ",a#
ENDIF
GOTO merrill
jerky_joel:
RETURN
' ----------------------------| "About" panel
> PROCEDURE about_foolish
~RSRC_GADDR(0,2,dialog_one%) !Return RSC address for dialog panel
~FORM_CENTER(dialog_one%,x%,y%,w%,h%) !Center it on the screen
@growbox
~OBJC_DRAW(dialog_one%,0,5,x%,y%,w%,h%) !Draw it
ex_obj%=FORM_DO(dialog_one%,0) !Wait for exit object to be chosen
' sort of like key=INP(2)
RETURN
' ----------------------------| End on error
> PROCEDURE oops
~MENU_BAR(menu_adr%,0) !Return menu bar address
~RSRC_FREE() !Return memory block used by RSC load
@restore_palette !Restore original screen colours
ALERT 2,"|Oops...must be an error |somewhere...",1," Bye ",aa#
END
RETURN
' ----------------------------| Graphic "zoomboxes"
> PROCEDURE growbox
~GRAF_GROWBOX(0,0,0,0,x%,y%,w%,h%)
RETURN
> PROCEDURE shrinkbox
~GRAF_SHRINKBOX(0,0,0,0,x%,y%,w%,h%)
RETURN
' ----------------------------| RADIO buttons
> PROCEDURE listing
ERASE ra%()
DIM ra%(3)
LET ra%(1)=3 !Radio Button A
LET ra%(2)=4 !Radio Button B
LET ra%(3)=5 !Radio Button C
RETURN
> PROCEDURE check_radios
FOR i%=1 TO 3
IF BTST(OB_STATE(panel%,ra%(i%)),0) !If button is chosen
radio%=ra%(i%)
ENDIF
NEXT i%
IF radio%<>0 AND radio%=3
rad$="A"
ELSE IF radio%<>0 AND radio%=4
rad$="B"
ELSE IF radio%<>0 AND radio%=5
rad$="C"
ELSE
rad$="NONE"
ENDIF
ALERT 1,"|You have chosen |Radio Button "+rad$+" ",1," So ? ",a#
RETURN
' ----------------------------|